package com.wander.business.book.c2_1_2;

import com.wander.business.book.c2_1_2.config.BookConfig_c2_1_2;
import com.wander.business.book.c2_1_2.service.DemoPrototypeService;
import com.wander.business.book.c2_1_2.service.DemoSingletonService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author Wander.Zeng
 * @create 2017-08-13 09:22
 * @desc BookMain
 */
public class BookMain {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(BookConfig_c2_1_2.class);

        DemoSingletonService s1 = context.getBean(DemoSingletonService.class);
        DemoSingletonService s2 = context.getBean(DemoSingletonService.class);

        DemoPrototypeService p1 = context.getBean(DemoPrototypeService.class);
        DemoPrototypeService p2 = context.getBean(DemoPrototypeService.class);

        System.out.println("s1 与 s2 是否相等：" + s1.equals(s2));
        System.out.println("p1 与 p2 是否相等：" + p1.equals(p2));

        context.close();
    }

}
